package com.liujs.api;

import com.liujs.Entity.TenantDo;
import com.liujs.mapper.TenantDoMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author liujs@centaline.com.cn
 * @description
 * @date 2020/10/13 15:52
 */
@RestController
@RequestMapping
public class UserController {

    @Autowired
    private TenantDoMapper userMapper;

    @GetMapping("/{name}/list")
    public List<TenantDo> list(@PathVariable("name") String name) {
        if (name.equals("dg")) {
            return userMapper.queryAllWithMaster();
        }
        if (name.equals("tj")) {
            return userMapper.queryAllWithSlave();
        }
        return null;
    }
}
